package com.zhiwang.planet.download

import android.content.Context
import android.content.Intent


class DownLoadManager private constructor(var context: Context) {


    companion object {
        fun create(context: Context): DownLoadManager {
            return DownLoadManager(context)
        }
    }

    /**
     * 直接在前台下载
     */
    fun downloadFile(url: String, progressListener: ProgressListener) {

    }

    /**
     * 后台service下载
     */
    fun downLoadFileBackground(url: String,name:String="") {
        val intent = Intent(context, BackUpDownLoadService::class.java)
        intent.putExtra(BackUpDownLoadService.URL_KEY, url)
        intent.putExtra(BackUpDownLoadService.NAME_KEY,name)
        context.applicationContext.startService(intent)
    }
}